package com.taiyi.renaissancemall.adapter;

import android.app.Dialog;
import android.app.ExpandableListActivity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Paint;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.PagerSnapHelper;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.taiyi.renaissancemall.R;
import com.taiyi.renaissancemall.Utils.ActivityUtils;
import com.taiyi.renaissancemall.Utils.ToastUtils;
import com.taiyi.renaissancemall.adapter.baseadapter.CommonAdapter;
import com.taiyi.renaissancemall.adapter.baseadapter.base.ViewHolder;
import com.taiyi.renaissancemall.base.MyApp;
import com.taiyi.renaissancemall.bean.AddressListBean;
import com.taiyi.renaissancemall.bean.AllCommentListBean;
import com.taiyi.renaissancemall.bean.BrandListBean;
import com.taiyi.renaissancemall.bean.FindBrandListBean;
import com.taiyi.renaissancemall.bean.FirstBean;
import com.taiyi.renaissancemall.bean.FirstClassSwitchBean;
import com.taiyi.renaissancemall.bean.ImageGoodsListBean;
import com.taiyi.renaissancemall.bean.MenuBean;
import com.taiyi.renaissancemall.bean.MessageBean;
import com.taiyi.renaissancemall.bean.OrderListBean;
import com.taiyi.renaissancemall.bean.PaySuccessBean;
import com.taiyi.renaissancemall.bean.SearchHistoryBean;
import com.taiyi.renaissancemall.bean.SearchKindBean;
import com.taiyi.renaissancemall.bean.SearchListBean;
import com.taiyi.renaissancemall.bean.ShoppingCarListBean;
import com.taiyi.renaissancemall.bean.ToFillOrderBean;
import com.taiyi.renaissancemall.ui.MainActivity;
import com.taiyi.renaissancemall.ui.MainPresent;
import com.taiyi.renaissancemall.ui.classification.goodlist.GoodListActivity;
import com.taiyi.renaissancemall.ui.main.brand.BrandListActivity;
import com.taiyi.renaissancemall.ui.main.first.memberBenefits.MemberBenefitsActivity;
import com.taiyi.renaissancemall.ui.main.first.memberBenefits.editOrder.MemberEditOrderActivity;
import com.taiyi.renaissancemall.ui.main.goodsdetail.GoodsDetailActivity;
import com.taiyi.renaissancemall.ui.main.imagegoodlist.ImageGoodsListActivity;
import com.taiyi.renaissancemall.ui.mine.address.ShippingAddressActivity;
import com.taiyi.renaissancemall.ui.mine.address.add.AddAddressActivity;
import com.taiyi.renaissancemall.ui.mine.order.detail.OrderDetailActivity;
import com.taiyi.renaissancemall.ui.mine.order.evaluation.EvaluationActivity;
import com.taiyi.renaissancemall.ui.mine.order.orderExpress.OrderExpressActivity;
import com.taiyi.renaissancemall.ui.mine.order.sale.ApplySaleActivity;
import com.taiyi.renaissancemall.ui.mine.order.sale.refund.ApplyRefundActivity;

import org.greenrobot.eventbus.EventBus;

import java.util.ArrayList;
import java.util.List;

public class AdapterManager {
    static CommonAdapter mCommonAdapter;

    public static CommonAdapter getMineFunctionalListAdapter(Context context, List<MenuBean> list) {
        mCommonAdapter = new CommonAdapter<MenuBean>(context, R.layout.menu_item_layout, list) {
            @Override
            protected void convert(ViewHolder holder, MenuBean o, int position) {
                holder.setText(R.id.tv, list.get(position).getTitle());
                holder.setImageResource(R.id.iv, list.get(position).getResId());
            }

        };
        return mCommonAdapter;

    }

    public static CommonAdapter getMineMenuListAdapter(Context context, List<MenuBean> list) {
        mCommonAdapter = new CommonAdapter<MenuBean>(context, R.layout.mine_bottom_item_layout, list) {
            @Override
            protected void convert(ViewHolder holder, MenuBean o, int position) {
                holder.setText(R.id.tv, list.get(position).getTitle());
                if (position == list.size() - 1) {
                    String appVersionCode = getAppVersionCode();
                    holder.setText(R.id.currentVersionTv, appVersionCode);
                }
            }
        };
        return mCommonAdapter;
    }

    static String appVersionCode = "";

    public static String getAppVersionCode() {
        PackageInfo packageInfo;
        try {
            packageInfo = MyApp.getInstance().getApplicationContext().getPackageManager().getPackageInfo(MyApp.getInstance().getPackageName(), 0);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
                appVersionCode = packageInfo.versionName;
            } else {
                appVersionCode = packageInfo.versionName;
            }
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
        return appVersionCode;
    }

    public static CommonAdapter getHotSearchHistoryAdapter(Context context, List<SearchHistoryBean.RelistBean> hotList) {
        mCommonAdapter = new CommonAdapter<SearchHistoryBean.RelistBean>(context, R.layout.search_rect_item_layout, hotList) {
            @Override
            protected void convert(ViewHolder holder, SearchHistoryBean.RelistBean relistBean, int position) {
                holder.setText(R.id.tv, relistBean.getCategoryname());
            }
        };
        return mCommonAdapter;
    }

    public static CommonAdapter getSearchHistoryAdapter(Context context, List<SearchHistoryBean.SearchlistBean> hotList) {
        mCommonAdapter = new CommonAdapter<SearchHistoryBean.SearchlistBean>(context, R.layout.search_rect_item_layout, hotList) {
            @Override
            protected void convert(ViewHolder holder, SearchHistoryBean.SearchlistBean relistBean, int position) {
                holder.setText(R.id.tv, relistBean.getContent());
            }
        };
        return mCommonAdapter;
    }


    public static CommonAdapter getSearchListAdapter(Context context, List<SearchListBean.ComlistBean> hotList) {
        mCommonAdapter = new CommonAdapter<SearchListBean.ComlistBean>(context, R.layout.search_result_item_layout, hotList) {
            @Override
            protected void convert(ViewHolder holder, SearchListBean.ComlistBean relistBean, int position) {

                holder.setNetworkImage(R.id.iv, relistBean.getSmallimgurl());
                holder.setText(R.id.titleTv, relistBean.getName());
                holder.setText(R.id.bvPriceTv, relistBean.getBvprice() + "BV");
                holder.setText(R.id.priceTv, "￥" + relistBean.getPrice());
                holder.setText(R.id.memberPriceTv, "￥" + relistBean.getHyprice());
                holder.setText(R.id.sanPriceTv, "￥" + relistBean.getSanfprice());
                ((TextView) holder.getView(R.id.sanPriceTv)).getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);

            }
        };
        return mCommonAdapter;
    }


    public static CommonAdapter getImageAdapter(Context context, List<String> list) {
        mCommonAdapter = new CommonAdapter<String>(context, R.layout.image_layout, list) {
            @Override
            protected void convert(ViewHolder holder, String url, int position) {
                holder.setNetworkImage(R.id.iv, url);
            }
        };
        return mCommonAdapter;
    }

    public static CommonAdapter getCommentListImageAdapter(Context context, List<String> list) {
        mCommonAdapter = new CommonAdapter<String>(context, R.layout.image_comment_layout, list) {
            @Override
            protected void convert(ViewHolder holder, String url, int position) {
                holder.setNetworkImage(R.id.iv, url);
            }
        };
        return mCommonAdapter;
    }

    public static CommonAdapter getShoppingCarListAdapter(Context context, List<ToFillOrderBean.ProductBean.DetailsBean> list, String ishui) {
        mCommonAdapter = new CommonAdapter<ToFillOrderBean.ProductBean.DetailsBean>(context, R.layout.fill_order_shopping_car_child_item_layout, list) {
            @Override
            protected void convert(ViewHolder holder, ToFillOrderBean.ProductBean.DetailsBean cartListBean, int position) {
                holder.setNetworkImage(R.id.iv, cartListBean.getSmallimgurl());
                holder.setText(R.id.titleTv, cartListBean.getName());
                holder.setText(R.id.specificationTv, cartListBean.getTypename());
                holder.setText(R.id.bvPriceTv, cartListBean.getBvprice() + "BV");
                holder.setText(R.id.quantityTv, "x" + cartListBean.getNumber());
                if (ishui.equals("1")) {
                    holder.setVisible(R.id.memberPrice, true);
                    holder.setText(R.id.memberPriceTv, "￥" + cartListBean.getHyprice());
                } else {
                    holder.setVisible(R.id.memberPrice, false);
                    holder.setText(R.id.memberPriceTv, "￥" + cartListBean.getPrice());
                }
//                holder.setSelected(R.id.selectTv, cartListBean.isSelectState());
                holder.setVisible(R.id.selectTv, false);
            }
        };
        return mCommonAdapter;
    }

    public static String orderId;

    public static CommonAdapter getOrderListAdapter(Context context, List<OrderListBean.OrderlistBean> list, String ifhui) {

        Dialog mDialog = new Dialog(context, R.style.MyDialog);
        View view = LayoutInflater.from(context).inflate(R.layout.cancel_order_dialog_layout, null);
        mDialog.setContentView(view);
        view.findViewById(R.id.thinkAgainTv).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mDialog.dismiss();
            }
        });

        view.findViewById(R.id.confirmTv).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mDialog.dismiss();
                EventBus.getDefault().post("cancelOrderId" + orderId);
            }
        });

        mCommonAdapter = new CommonAdapter<OrderListBean.OrderlistBean>(context, R.layout.pending_payment_item_layout, list) {
            @Override
            protected void convert(ViewHolder holder, OrderListBean.OrderlistBean orderlistBean, int position) {
                holder.setNetworkImage(R.id.productIv, orderlistBean.getSmallimgurl());
                holder.setText(R.id.productNameTv, orderlistBean.getName());
                holder.setText(R.id.specTv, orderlistBean.getTypename());
                holder.setText(R.id.quantityTv, "x" + orderlistBean.getNumber());
                if ("1".equals(orderlistBean.getType())) {
//                    if ("1".equals(ifhui))
//                        holder.setText(R.id.priceTv, "￥" + orderlistBean.getHyprice());
//                    else {
                    holder.setText(R.id.priceTv, "￥" + orderlistBean.getPrice());
//                    }
//                    if ("1".equals(ifhui)) {
//                        double total = Integer.parseInt(orderlistBean.getNumber()) * Double.parseDouble(orderlistBean.getHyprice());
//                        holder.setText(R.id.totalPriceTv, "共" + orderlistBean.getNumber() + "件商品，合计￥" + total);
//                    } else {
//                        double total = Integer.parseInt(orderlistBean.getNumber()) * Double.parseDouble(orderlistBean.getPrice());
                    holder.setText(R.id.totalPriceTv, "共" + orderlistBean.getNumber() + "件商品，合计￥" + (Double.parseDouble(orderlistBean.getSumprice()) + Double.parseDouble(orderlistBean.getYunfei())));
//                    }
                } else {
                    holder.setText(R.id.priceTv, "￥" + orderlistBean.getPrice());
//                    double total = Integer.parseInt(orderlistBean.getNumber()) * Double.parseDouble(orderlistBean.getPrice());

                    holder.setText(R.id.totalPriceTv, "共" + orderlistBean.getNumber() + "件商品，合计￥" + (Double.parseDouble(orderlistBean.getSumprice()) + Double.parseDouble(orderlistBean.getYunfei())));
                }
                holder.setOnClickListener(R.id.updateAddressTv, new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        OrderListBean.OrderlistBean bean = list.get(position);
                        String ordercommodityid = bean.getOrdercommodityid();
                        Intent intent = new Intent(context, ShippingAddressActivity.class);
                        intent.putExtra("ordercommodityid", ordercommodityid);
                        context.startActivity(intent);
                    }
                });

                holder.setOnClickListener(R.id.cancelOrderTv, new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        mDialog.show();
                        orderId = list.get(position).getOrdercommodityid();
                    }
                });
            }
        };
        return mCommonAdapter;
    }

    public static CommonAdapter getCommentListAdapter(Context context, List<OrderListBean.OrderlistBean> list, String ifhui) {
        mCommonAdapter = new CommonAdapter<OrderListBean.OrderlistBean>(context, R.layout.comment_item_layout, list) {
            @Override
            protected void convert(ViewHolder holder, OrderListBean.OrderlistBean orderlistBean, int position) {
                holder.setNetworkImage(R.id.productIv, orderlistBean.getSmallimgurl());
                holder.setText(R.id.productNameTv, orderlistBean.getName());
                if (!TextUtils.isEmpty(orderlistBean.getTypename())) {
                    holder.setText(R.id.specTv, orderlistBean.getTypename());
                    holder.setText(R.id.quantityTv, "x" + orderlistBean.getNumber());
                } else {
                    holder.setText(R.id.specTv, "会员福利商品");
                    holder.setText(R.id.quantityTv, "x" + orderlistBean.getNumber());
                }
                if ("1".equals(orderlistBean.getType())) {
//                    if ("1".equals(ifhui))
//                        holder.setText(R.id.priceTv, "￥" + orderlistBean.getHyprice());
//                    else {
                    holder.setText(R.id.priceTv, "￥" + orderlistBean.getPrice());
//                    }
//                    if ("1".equals(ifhui)) {
//                        double total = Integer.parseInt(orderlistBean.getNumber()) * Double.parseDouble(orderlistBean.getHyprice());
//                        holder.setText(R.id.totalPriceTv, "共" + orderlistBean.getNumber() + "件商品，合计￥" + total);
//                    } else {
//                        double total = Integer.parseInt(orderlistBean.getNumber()) * Double.parseDouble(orderlistBean.getPrice());
//                        holder.setText(R.id.totalPriceTv, "共" + orderlistBean.getNumber() + "件商品，合计￥" + total);
//                    }
                    holder.setText(R.id.totalPriceTv, "共" + orderlistBean.getNumber() + "件商品，合计￥" + (Double.parseDouble(orderlistBean.getSumprice()) + Double.parseDouble(orderlistBean.getYunfei())));
                } else {
                    holder.setText(R.id.priceTv, "￥" + orderlistBean.getPrice());
//                    double total = Integer.parseInt(orderlistBean.getNumber()) * Double.parseDouble(orderlistBean.getPrice());
//                    holder.setText(R.id.totalPriceTv, "共" + orderlistBean.getNumber() + "件商品，合计￥" + total);
                    holder.setText(R.id.totalPriceTv, "共" + orderlistBean.getNumber() + "件商品，合计￥" + (Double.parseDouble(orderlistBean.getSumprice()) + Double.parseDouble(orderlistBean.getYunfei())));
                }

                holder.setOnClickListener(R.id.evaluationTv, new View.OnClickListener() {//评价
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent(context, EvaluationActivity.class);
                        intent.putExtra("oId", list.get(position).getOrdercommodityid());
                        context.startActivity(intent);
                    }
                });
                holder.setOnClickListener(R.id.applySaleTv, new View.OnClickListener() {//申请售后
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent(context, ApplySaleActivity.class);
                        intent.putExtra("product", orderlistBean);
                        context.startActivity(intent);
                    }
                });
                if (orderlistBean.getShou_type().equals("1")) {
                    holder.setVisible(R.id.applySaleTv, true);
                } else {
                    holder.setVisible(R.id.applySaleTv, false);
                }

            }
        };
        return mCommonAdapter;
    }


    public static CommonAdapter getOrderListDeliveredAdapter(Context context, List<OrderListBean.OrderlistBean> list, String ifhui) {

        mCommonAdapter = new CommonAdapter<OrderListBean.OrderlistBean>(context, R.layout.delivered_item_layout, list) {
            @Override
            protected void convert(ViewHolder holder, OrderListBean.OrderlistBean orderlistBean, int position) {
                holder.setNetworkImage(R.id.productIv, orderlistBean.getSmallimgurl());
                holder.setText(R.id.productNameTv, orderlistBean.getName());
                if (!TextUtils.isEmpty(orderlistBean.getTypename())) {
                    holder.setText(R.id.specTv, orderlistBean.getTypename());
                    holder.setText(R.id.quantityTv, "x" + orderlistBean.getNumber());
                } else {
                    holder.setText(R.id.specTv, "会员福利商品");
                    holder.setText(R.id.quantityTv, "x" + orderlistBean.getNumber());
                }
                if ("1".equals(orderlistBean.getType())) {
//                    if ("1".equals(ifhui))
//                        holder.setText(R.id.priceTv, "￥" + orderlistBean.getHyprice());
//                    else {
                    holder.setText(R.id.priceTv, "￥" + orderlistBean.getPrice());
//                    }
//                    if ("1".equals(ifhui)) {
//                        double total = Integer.parseInt(orderlistBean.getNumber()) * Double.parseDouble(orderlistBean.getHyprice());
                    holder.setText(R.id.totalPriceTv, "共" + orderlistBean.getNumber() + "件商品，合计￥" + (Double.parseDouble(orderlistBean.getSumprice()) + Double.parseDouble(orderlistBean.getYunfei())));
//                    } else {
////                        double total = Integer.parseInt(orderlistBean.getNumber()) * Double.parseDouble(orderlistBean.getPrice());
//                        holder.setText(R.id.totalPriceTv, "共" + orderlistBean.getNumber() + "件商品，合计￥" + total);
//                    }
                } else {
                    holder.setText(R.id.priceTv, "￥" + orderlistBean.getPrice());
                    double total = Integer.parseInt(orderlistBean.getNumber()) * Double.parseDouble(orderlistBean.getPrice());
                    holder.setText(R.id.totalPriceTv, "共" + orderlistBean.getNumber() + "件商品，合计￥" + (Double.parseDouble(orderlistBean.getSumprice()) + Double.parseDouble(orderlistBean.getYunfei())));
                }
                holder.setOnClickListener(R.id.remindTv, new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        EventBus.getDefault().post("orderId" + list.get(position).getOrdercommodityid());
                    }
                });
                holder.setOnClickListener(R.id.applySaleTv, new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent(context, ApplySaleActivity.class);
                        intent.putExtra("product", orderlistBean);
                        intent.putExtra("ifHui", ifhui);
                        context.startActivity(intent);
                    }
                });


            }
        };
        return mCommonAdapter;
    }

    public static CommonAdapter getOrderListSaleAdapter(Context context, List<OrderListBean.OrderlistBean> list, String ifhui) {

        mCommonAdapter = new CommonAdapter<OrderListBean.OrderlistBean>(context, R.layout.sale_item_layout, list) {
            @Override
            protected void convert(ViewHolder holder, OrderListBean.OrderlistBean orderlistBean, int position) {
                holder.setNetworkImage(R.id.productIv, orderlistBean.getSmallimgurl());
                holder.setText(R.id.productNameTv, orderlistBean.getName());
                holder.setText(R.id.specTv, orderlistBean.getTypename());
//                holder.setText(R.id.quantityTv, "x" + orderlistBean.getNumber());
                String return_type = orderlistBean.getReturn_type();
                if ("0".equals(return_type)) {
                    holder.setText(R.id.quantityTv, "无申请");
                } else if ("1".equals(return_type)) {
                    holder.setText(R.id.quantityTv, "申请退货中");
                } else if ("2".equals(return_type)) {
                    holder.setText(R.id.quantityTv, "同意退货");
                } else if ("3".equals(return_type)) {
                    holder.setText(R.id.quantityTv, "拒绝退货");
                } else if ("4".equals(return_type)) {
                    holder.setText(R.id.quantityTv, "退货成功");
                } else if ("5".equals(return_type)) {
                    holder.setText(R.id.quantityTv, "退货失败");
                } else if ("6".equals(return_type)) {
                    holder.setText(R.id.quantityTv, "申请退款中");
                } else if ("7".equals(return_type)) {
                    holder.setText(R.id.quantityTv, "退款成功");
                } else if ("8".equals(return_type)) {
                    holder.setText(R.id.quantityTv, "退款失败");
                } else if ("9".equals(return_type)) {
                    holder.setText(R.id.quantityTv, "拒绝退款");
                } else if ("10".equals(return_type)) {
                    holder.setText(R.id.quantityTv, "同意退款");
                } else if ("11".equals(return_type)) {
                    holder.setText(R.id.quantityTv, "申请换货中");
                } else if ("12".equals(return_type)) {
                    holder.setText(R.id.quantityTv, "同意换货");
                } else if ("13".equals(return_type)) {
                    holder.setText(R.id.quantityTv, "换货已发货");
                } else if ("14".equals(return_type)) {
                    holder.setText(R.id.quantityTv, "换货成功");
                } else if ("15".equals(return_type)) {
                    holder.setText(R.id.quantityTv, "换货失败");
                } else if ("16".equals(return_type)) {
                    holder.setText(R.id.quantityTv, "拒绝换货");
                }
                if ("1".equals(orderlistBean.getType())) {
//                    if ("1".equals(ifhui))
//                        holder.setText(R.id.priceTv, "￥" + orderlistBean.getHyprice());
//                    else {
                    holder.setText(R.id.priceTv, "￥" + orderlistBean.getPrice());
//                    }
//                    if ("1".equals(ifhui)) {
//                        double total = Integer.parseInt(orderlistBean.getNumber()) * Double.parseDouble(orderlistBean.getHyprice());
//                        holder.setText(R.id.totalPriceTv, "共" + orderlistBean.getNumber() + "件商品，合计￥" + total);
//                    } else {
//                        double total = Integer.parseInt(orderlistBean.getNumber()) * Double.parseDouble(orderlistBean.getPrice());
//                        holder.setText(R.id.totalPriceTv, "共" + orderlistBean.getNumber() + "件商品，合计￥" + total);
//                    }
                    holder.setText(R.id.totalPriceTv, "共" + orderlistBean.getNumber() + "件商品，合计￥" + (Double.parseDouble(orderlistBean.getSumprice()) + Double.parseDouble(orderlistBean.getYunfei())));
                } else {
                    holder.setText(R.id.priceTv, "￥" + orderlistBean.getPrice());
//                    double total = Integer.parseInt(orderlistBean.getNumber()) * Double.parseDouble(orderlistBean.getPrice());
//                    holder.setText(R.id.totalPriceTv, "共" + orderlistBean.getNumber() + "件商品，合计￥" + total);
                    holder.setText(R.id.totalPriceTv, "共" + orderlistBean.getNumber() + "件商品，合计￥" + (Double.parseDouble(orderlistBean.getSumprice()) + Double.parseDouble(orderlistBean.getYunfei())));
                }

                if ("1".equals(orderlistBean.getReturn_type()) || "11".equals(orderlistBean.getReturn_type())) {//显示订单号
                    holder.setVisible(R.id.viewDetailTv, false);
                    holder.setVisible(R.id.fillOrderNumberTv, true);
                } else {
                    holder.setVisible(R.id.viewDetailTv, true);
                    holder.setVisible(R.id.fillOrderNumberTv, false);
                }

                holder.setOnClickListener(R.id.fillOrderNumberTv, new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent(context, ApplyRefundActivity.class);
                        intent.putExtra("typeCode", "4");
                        intent.putExtra("oId", orderlistBean.getOrdercommodityid());
                        context.startActivity(intent);
                    }
                });
                holder.setOnClickListener(R.id.viewDetailTv, new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent(context, OrderDetailActivity.class);
                        Bundle bundle = new Bundle();
                        bundle.putString("ordercommodityid", orderlistBean.getOrdercommodityid());
                        bundle.putString("orderType", "5");
                        bundle.putString("orderId", "");
                        intent.putExtra("returnType", orderlistBean.getReturn_type());
                        intent.putExtras(bundle);
                        context.startActivity(intent);
                    }
                });

            }
        };
        return mCommonAdapter;
    }

    public static CommonAdapter getOrderListCompletedAdapter(Context context, List<OrderListBean.OrderlistBean> list, String ifhui) {

        mCommonAdapter = new CommonAdapter<OrderListBean.OrderlistBean>(context, R.layout.completed_item_layout, list) {
            @Override
            protected void convert(ViewHolder holder, OrderListBean.OrderlistBean orderlistBean, int position) {
                holder.setNetworkImage(R.id.productIv, orderlistBean.getSmallimgurl());
                holder.setText(R.id.productNameTv, orderlistBean.getName());
                holder.setText(R.id.specTv, orderlistBean.getTypename());
                holder.setText(R.id.quantityTv, "已完成");
                holder.setText(R.id.priceTv, "￥" + orderlistBean.getPrice());
            }
        };
        return mCommonAdapter;
    }

    public static CommonAdapter getOrderListReceivedAdapter(Context context, List<OrderListBean.OrderlistBean> list, String ifhui) {

        mCommonAdapter = new CommonAdapter<OrderListBean.OrderlistBean>(context, R.layout.received_item_layout, list) {
            @Override
            protected void convert(ViewHolder holder, OrderListBean.OrderlistBean orderlistBean, int position) {
                holder.setNetworkImage(R.id.productIv, orderlistBean.getSmallimgurl());
                holder.setText(R.id.productNameTv, orderlistBean.getName());
                if (!TextUtils.isEmpty(orderlistBean.getTypename())) {
                    holder.setText(R.id.specTv, orderlistBean.getTypename());
                    holder.setText(R.id.quantityTv, "x" + orderlistBean.getNumber());
                } else {
                    holder.setText(R.id.specTv, "会员福利商品");
                    holder.setText(R.id.quantityTv, "x" + orderlistBean.getNumber());
                }
                if ("1".equals(orderlistBean.getType())) {
//                    if ("1".equals(ifhui))
//                        holder.setText(R.id.priceTv, "￥" + orderlistBean.getHyprice());
//                    else {
                    holder.setText(R.id.priceTv, "￥" + orderlistBean.getPrice());
//                    }
//                    if ("1".equals(ifhui)) {
//                        double total = Integer.parseInt(orderlistBean.getNumber()) * Double.parseDouble(orderlistBean.getHyprice());
//                        holder.setText(R.id.totalPriceTv, "共" + orderlistBean.getNumber() + "件商品，合计￥" + total);
//                    } else {
//                        double total = Integer.parseInt(orderlistBean.getNumber()) * Double.parseDouble(orderlistBean.getPrice());
//                        holder.setText(R.id.totalPriceTv, "共" + orderlistBean.getNumber() + "件商品，合计￥" + total);
//                    }
                    holder.setText(R.id.totalPriceTv, "共" + orderlistBean.getNumber() + "件商品，合计￥" + (Double.parseDouble(orderlistBean.getSumprice()) + Double.parseDouble(orderlistBean.getYunfei())));
                } else {
                    holder.setText(R.id.priceTv, "￥" + orderlistBean.getPrice());
//                    double total = Integer.parseInt(orderlistBean.getNumber()) * Double.parseDouble(orderlistBean.getPrice());
//                    holder.setText(R.id.totalPriceTv, "共" + orderlistBean.getNumber() + "件商品，合计￥" + total);
                    holder.setText(R.id.totalPriceTv, "共" + orderlistBean.getNumber() + "件商品，合计￥" + (Double.parseDouble(orderlistBean.getSumprice()) + Double.parseDouble(orderlistBean.getYunfei())));
                }
                holder.setOnClickListener(R.id.receiptApplySaleTv, new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent(context, ApplySaleActivity.class);
                        intent.putExtra("product", orderlistBean);
                        intent.putExtra("ifHui", ifhui);
                        context.startActivity(intent);
                    }
                });
                holder.setOnClickListener(R.id.viewLogisticsTv, new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent(context, OrderExpressActivity.class);
                        intent.putExtra("ocId", list.get(position).getOrdercommodityid());
                        context.startActivity(intent);
                    }
                });

                holder.setOnClickListener(R.id.confirmReceiptTv, new View.OnClickListener() {//确认收货
                    @Override
                    public void onClick(View v) {
                        EventBus.getDefault().post("confirmReceived" + orderlistBean.getOrdercommodityid());
                    }
                });


            }
        };
        return mCommonAdapter;
    }


    public static CommonAdapter getFirstBrandImgAdapter(Context context, List<FirstBean.BrandlistBean> data) {
        Context mContext = context.getApplicationContext();
        mCommonAdapter = new CommonAdapter<FirstBean.BrandlistBean>(context, R.layout.home_image_layout, data) {
            @Override
            protected void convert(ViewHolder holder, FirstBean.BrandlistBean o, int position) {
                holder.setNetworkCircleImage(R.id.iv, o.getIntroimg());
                holder.setOnClickListener(R.id.iv, new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        int brandid = o.getBrandid();
                        //跳转品牌列表
                        Intent intent = new Intent(mContext, BrandListActivity.class);
                        intent.putExtra("brandId", String.valueOf(brandid));
                        intent.putExtra("brandName", o.getBrandname());
                        mContext.startActivity(intent);
                    }
                });
            }

            @Override
            public void onViewRecycled(@NonNull ViewHolder holder) {
                super.onViewRecycled(holder);
                ImageView iv = holder.getView(R.id.iv);
                if (iv != null) {
                    Glide.with(mContext).clear(iv);
                }
            }
        };
        return mCommonAdapter;
    }

    public static CommonAdapter getFirstBrandProductAdapter(Context context, List<FirstBean.Cate1listBean> data) {
        mCommonAdapter = new CommonAdapter<FirstBean.Cate1listBean>(context, R.layout.brand_store_product_item_layout, data) {
            @Override
            protected void convert(ViewHolder holder, FirstBean.Cate1listBean o, int position) {
                holder.setText(R.id.brandLeftTitleTv, o.getCategoryname());
                holder.setText(R.id.brandLeftildTitleTv, o.getIntroname());
                holder.setOnClickListener(R.id.tv_brand_right_more, new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        if (o.getCategoryname().equals("会员福利")) {
                            Intent intent = new Intent(context, MemberBenefitsActivity.class);
                            intent.putExtra("introimg", o.getIntroimg());
                            context.startActivity(intent);
                        } else {
                            //跳转分类商品列表
                            Intent intent = new Intent(context, ImageGoodsListActivity.class);
                            intent.putExtra("categoryId", o.getCategoryid());
                            intent.putExtra("labelId", "");
                            intent.putExtra("source", 1);
                            intent.putExtra("topImg", o.getIntroimg());
                            intent.putExtra("labelName", o.getCategoryname());
                            context.startActivity(intent);
                        }
                    }
                });
                List<FirstBean.Cate1listBean.ComlistBeanX> comlist = o.getComlist();
                holder.setRecyclerViewGrid(R.id.recyclerView, AdapterManager.getFirstBrandProductListAdapter(context, comlist), 2);
            }
        };
        return mCommonAdapter;
    }

    public static CommonAdapter getFirstBrandProductListAdapter(Context context, List<FirstBean.Cate1listBean.ComlistBeanX> data) {

        Dialog mDialog = new Dialog(context, R.style.MyDialog);
        View view = LayoutInflater.from(context).inflate(R.layout.hy_dialog_layout, null);
        RecyclerView recyclerView = view.findViewById(R.id.recyclerView);
        TextView nameTv = view.findViewById(R.id.nameTv);
        LinearLayout container = view.findViewById(R.id.container);
        TextView descriptionTv = view.findViewById(R.id.descriptionTv);
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
        linearLayoutManager.setOrientation(RecyclerView.HORIZONTAL);
        recyclerView.setLayoutManager(linearLayoutManager);
        PagerSnapHelper pagerSnapHelper = new PagerSnapHelper();
        mDialog.setContentView(view);
        mDialog.setCanceledOnTouchOutside(true);
        mCommonAdapter = new CommonAdapter<FirstBean.Cate1listBean.ComlistBeanX>(context, R.layout.first_brand_product_item_layout, data) {
            @Override
            protected void convert(ViewHolder holder, FirstBean.Cate1listBean.ComlistBeanX o, int position) {
                holder.setNetworkImage(R.id.productIv, o.getSmallimgurl());

                if (o.getType().equals("1")) {
                    holder.setText(R.id.marketPriceTv, "￥" + o.getSanfprice());
                    ((TextView) holder.getView(R.id.marketPriceTv)).getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
                    holder.setText(R.id.priceTv, "￥" + o.getHyprice());
                    holder.setVisible(R.id.priceTv, true);
                    holder.setVisible1(R.id.productNameTv, false);
                    holder.setVisible(R.id.scj, true);
                    holder.setVisible(R.id.hPriceTv, false);
                    holder.setVisible(R.id.buyTv, false);
                    holder.setVisible(R.id.marketPriceTv, true);
                } else {//会员福利
                    holder.setVisible(R.id.scj, false);
                    holder.setVisible(R.id.marketPriceTv, false);
                    holder.setVisible(R.id.productNameTv, true);
                    holder.setVisible(R.id.priceTv, false);
                    holder.setText(R.id.productNameTv, o.getName());
                    holder.setVisible(R.id.hPriceTv, true);
                    holder.setVisible(R.id.buyTv, true);
                    holder.setText(R.id.hPriceTv, "￥0.0");
                }
                List<String> imageList = new ArrayList<>();
                List<ImageView> imgList = new ArrayList<>();
                holder.setOnClickListener(R.id.productIv, new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        if (o.getType().equals("2")) {
                            mDialog.show();
                            nameTv.setText(o.getName());
                            descriptionTv.setText(o.getCombz());
                            imageList.clear();
                            imgList.clear();
                            container.removeAllViews();
                            if (o.getComimgurl().contains(",")) {
                                for (int i = 0; i < o.getComimgurl().split(",").length; i++) {
                                    imageList.add(o.getComimgurl().split(",")[i]);
                                    ImageView imageView = new ImageView(context);
                                    if (i == 0) {
                                        imageView.setImageResource(R.mipmap.ind_yes_iv);
                                    } else {
                                        imageView.setImageResource(R.mipmap.ind_no_iv);
                                    }
                                    container.addView(imageView);
                                    imgList.add(imageView);
                                }
                            } else {
                                imageList.add(o.getComimgurl());
                                ImageView imageView = new ImageView(context);
                                imageView.setImageResource(R.mipmap.ind_yes_iv);
                                container.addView(imageView);
                            }

                            CommonAdapter imageListAdapter = getImageListAdapter(context, imageList);
                            recyclerView.setAdapter(imageListAdapter);
                            pagerSnapHelper.attachToRecyclerView(recyclerView);

                            recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
                                @Override
                                public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
                                    super.onScrollStateChanged(recyclerView, newState);
                                    LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
                                    if (newState == RecyclerView.SCROLL_STATE_IDLE) {
                                        int firstVisibleItemPosition = layoutManager.findFirstVisibleItemPosition();
                                        Log.i("currentPosition", "----" + firstVisibleItemPosition);
                                        for (int i = 0; i < imgList.size(); i++) {
                                            if (i == firstVisibleItemPosition) {
                                                imgList.get(i).setImageResource(R.mipmap.ind_yes_iv);
                                            } else {
                                                imgList.get(i).setImageResource(R.mipmap.ind_no_iv);
                                            }
                                        }
                                    }
                                }

                                @Override
                                public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
                                    super.onScrolled(recyclerView, dx, dy);

                                }
                            });
                        } else {
                            String commodityid = data.get(position).getCommodityid();
                            Intent intent = new Intent(context, GoodsDetailActivity.class);
                            Bundle bundle = new Bundle();
                            bundle.putString("commodityId", commodityid);
                            intent.putExtras(bundle);
                            context.startActivity(intent);
                        }
                    }
                });
                holder.setOnClickListener(R.id.constraint, new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {

                        if (o.getType().equals("1")) {//普通商品
//                            ToastUtils.showShortToast(o.getName());
                            String commodityid = data.get(position).getCommodityid();
                            Intent intent = new Intent(context, GoodsDetailActivity.class);
                            Bundle bundle = new Bundle();
                            bundle.putString("commodityId", commodityid);
                            intent.putExtras(bundle);
                            context.startActivity(intent);
                        } else if (o.getType().equals("2")) {//会员福利
//                            ToastUtils.showShortToast("-----" + o.getName());
                            Intent intent = new Intent(context, MemberEditOrderActivity.class);
                            intent.putExtra("commodityid", o.getCommodityid());
//                            intent.putExtra("salenum", salenum);
                            context.startActivity(intent);
                        }


                    }
                });
            }
        };
        return mCommonAdapter;
    }

    public static CommonAdapter getImageListAdapter(Context context, List<String> imgList) {
        mCommonAdapter = new CommonAdapter<String>(context, R.layout.image_item_layout, imgList) {
            @Override
            protected void convert(ViewHolder holder, String o, int position) {
                holder.setNetworkImageOne(R.id.iv, o);
            }
        };
        return mCommonAdapter;
    }


    public static CommonAdapter getFirstTypeAdapter(Context context, List<FirstBean.LablelistzongBean> data) {
        mCommonAdapter = new CommonAdapter<FirstBean.LablelistzongBean>(context, R.layout.first_menu_item_layout, data) {
            @Override
            protected void convert(ViewHolder holder, FirstBean.LablelistzongBean o, int position) {
                holder.setText(R.id.tv, o.getLablename());
                holder.setNetworkImage(R.id.iv, o.getLogo());
            }
        };
        return mCommonAdapter;
    }


    public static CommonAdapter getFirstThreeClassAdapter(Context context, List<FirstBean.Lable4Bean.LablelistBean> data) {
        mCommonAdapter = new CommonAdapter<FirstBean.Lable4Bean.LablelistBean>(context, R.layout.first_fragment_new_daily_tv_layout, data) {
            @Override
            protected void convert(ViewHolder holder, FirstBean.Lable4Bean.LablelistBean o, int position) {
                holder.setText(R.id.tv, o.getLablename());
                if (data.get(position).isSelect()) {
                    holder.setTextSize(R.id.tv, 16);
                } else {
                    holder.setTextSize(R.id.tv, 12);
                }
            }
        };
        return mCommonAdapter;
    }

    public static CommonAdapter getFirstBottomTitleAdapter(Context context, List<FirstBean.ClassindexBean.Classindex1Bean> data) {
        mCommonAdapter = new CommonAdapter<FirstBean.ClassindexBean.Classindex1Bean>(context, R.layout.first_fragment_new_daily_tv_layout, data) {
            @Override
            protected void convert(ViewHolder holder, FirstBean.ClassindexBean.Classindex1Bean o, int position) {
                holder.setText(R.id.tv, o.getName());
                if (data.get(position).isSelect()) {
                    holder.setTextSize(R.id.tv, 16);
                } else {
                    holder.setTextSize(R.id.tv, 12);
                }
            }
        };
        return mCommonAdapter;
    }

    public static CommonAdapter getFirstThreeClassProductAdapter(Context context, List<FirstBean.Lable4Bean.LablecomlistBean> data) {
        mCommonAdapter = new CommonAdapter<FirstBean.Lable4Bean.LablecomlistBean>(context, R.layout.first_goods_item_layout, data) {

            @Override
            protected void convert(ViewHolder holder, FirstBean.Lable4Bean.LablecomlistBean o, int position) {
                holder.setNetworkImage(R.id.productIv, o.getSmallimgurl());
                holder.setText(R.id.productNameTv, o.getName());
                holder.setText(R.id.sourcePriceTv, "￥" + o.getSanfprice());
                ((TextView) holder.getView(R.id.sourcePriceTv)).getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
                holder.setText(R.id.bvPriceTv, o.getHybvprice() + "BV");
                holder.setText(R.id.memberPriceTv, "￥" + o.getHyprice());
            }

            @Override
            public void onViewRecycled(@NonNull ViewHolder holder) {
                super.onViewRecycled(holder);
                ImageView productIv = holder.getView(R.id.productIv);
                if (productIv != null) {
                    Glide.with(context).clear(productIv);
                }
            }

        };
        return mCommonAdapter;
    }

    public static CommonAdapter getNewFirstThreeClassProductAdapter(Context context, List<FirstClassSwitchBean.LablecomlistBean> data) {
        mCommonAdapter = new CommonAdapter<FirstClassSwitchBean.LablecomlistBean>(context, R.layout.first_goods_item_layout, data) {
            @Override
            protected void convert(ViewHolder holder, FirstClassSwitchBean.LablecomlistBean o, int position) {
                holder.setNetworkImage(R.id.productIv, o.getSmallimgurl());
                holder.setText(R.id.productNameTv, o.getName());
                holder.setText(R.id.sourcePriceTv, "￥" + o.getPrice());
                ((TextView) holder.getView(R.id.sourcePriceTv)).getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
                holder.setText(R.id.bvPriceTv, o.getBvprice() + "BV");
                holder.setText(R.id.memberPriceTv, "￥" + o.getHyprice());

            }
        };
        return mCommonAdapter;
    }

    public static CommonAdapter getFirstBottomClassProductAdapter(Context context, List<FirstBean.ClassindexBean.ClasscomlistBean> data) {
        mCommonAdapter = new CommonAdapter<FirstBean.ClassindexBean.ClasscomlistBean>(context, R.layout.first_goods_item_layout, data) {
            @Override
            protected void convert(ViewHolder holder, FirstBean.ClassindexBean.ClasscomlistBean o, int position) {
                holder.setNetworkImage(R.id.productIv, o.getSmallimgurl());
                holder.setText(R.id.productNameTv, o.getName());
                holder.setText(R.id.sourcePriceTv, "￥" + o.getSanfprice());
                ((TextView) holder.getView(R.id.sourcePriceTv)).getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
                holder.setText(R.id.bvPriceTv, o.getHybvprice() + "BV");
                holder.setText(R.id.memberPriceTv, "￥" + o.getHyprice());
                holder.setOnClickListener(R.id.constraint, new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        String commodityid = data.get(position).getCommodityid();
                        Intent intent = new Intent(context, GoodsDetailActivity.class);
                        Bundle bundle = new Bundle();
                        bundle.putString("commodityId", commodityid);
                        intent.putExtras(bundle);
                        context.startActivity(intent);
                    }
                });
            }

            @Override
            public void onViewRecycled(@NonNull ViewHolder holder) {
                super.onViewRecycled(holder);
                ImageView productIv = holder.getView(R.id.productIv);
                if (productIv != null) {
                    Glide.with(context).clear(productIv);
                }
            }
        };
        return mCommonAdapter;
    }

    public static CommonAdapter
    getFirstBottomIconAdapter(Context context, List<FirstBean.ClassindexBean.Classindex3Bean> data) {
        mCommonAdapter = new CommonAdapter<FirstBean.ClassindexBean.Classindex3Bean>(context, R.layout.first_bottom_icon_item_iv, data) {
            @Override
            protected void convert(ViewHolder holder, FirstBean.ClassindexBean.Classindex3Bean o, int position) {
                holder.setText(R.id.topTv, o.getName());
                holder.loadCircleImage(R.id.iv, o.getImgurl());
                if (data.get(position).isSelected()) {
//                    holder.setSelected(R.id.tv, true);
                    holder.setSelected(R.id.topTv, true);
                } else {
//                    holder.setSelected(R.id.tv, false);
                    holder.setSelected(R.id.topTv, false);
                }
            }

        };
        return mCommonAdapter;
    }

    public static CommonAdapter
    getLimitProductListAdapter(Context context, List<FirstBean.Cate2listBean> data) {
        mCommonAdapter = new CommonAdapter<FirstBean.Cate2listBean>(context, R.layout.first_limit_time_item_layout, data) {
            @Override
            protected void convert(ViewHolder holder, FirstBean.Cate2listBean o, int position) {
                holder.setText(R.id.limitedTimeLeftTitleTv, o.getCategoryname());
                holder.setText(R.id.limitedTimeLeftChildTitleTv, o.getIntroname());
                holder.setNetworkImage(R.id.iv, o.getIntroimg());
            }
        };
        return mCommonAdapter;
    }


    public static CommonAdapter getAddressListAdapter(Context context, List<AddressListBean.AddresslistBean> data) {
        mCommonAdapter = new CommonAdapter<AddressListBean.AddresslistBean>(context, R.layout.address_list_item_layout, data) {
            @Override
            protected void convert(ViewHolder holder, AddressListBean.AddresslistBean o, int position) {
                holder.setText(R.id.nameTv, o.getName());
                holder.setText(R.id.shippingAddressTv, o.getProvincename() + o.getCityname() + o.getAreaname() + o.getAddress());
                holder.setText(R.id.phoneNumberTv, context.getString(R.string.contactNumber) + " " + o.getTel());
                holder.setVisible(R.id.defaultTv, o.getType().equals("1"));
                holder.setOnClickListener(R.id.editIv, new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent(context, AddAddressActivity.class);
                        intent.putExtra("addressId", o.getUseraddress_id());
                        context.startActivity(intent);
                    }
                });
            }
        };
        return mCommonAdapter;
    }


    public static CommonAdapter
    getSearchKindListAdapter(Context context, List<SearchKindBean> data) {
        mCommonAdapter = new CommonAdapter<SearchKindBean>(context, R.layout.search_rect_item_layout, data) {
            @Override
            protected void convert(ViewHolder holder, SearchKindBean o, int position) {
                holder.setText(R.id.tv, o.getCategoryname());
                holder.setOnClickListener(R.id.tv, new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        data.get(position).setSelect(!data.get(position).isSelect());
                        holder.setSelected(R.id.tv, data.get(position).isSelect());
                    }
                });
            }
        };
        return mCommonAdapter;
    }

    public static CommonAdapter
    getGoodKindListAdapter(Context context, List<FindBrandListBean.BrandlistBean> data) {
        mCommonAdapter = new CommonAdapter<FindBrandListBean.BrandlistBean>(context, R.layout.flow_tv_item_layout, data) {
            @Override
            protected void convert(ViewHolder holder, FindBrandListBean.BrandlistBean o, int position) {
                holder.setText(R.id.tv, o.brandname);
                holder.setOnClickListener(R.id.tv, new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        data.get(position).isChoose = !data.get(position).isChoose;
                        holder.setSelected(R.id.tv, data.get(position).isChoose);
                    }
                });
            }
        };
        return mCommonAdapter;
    }


    public static CommonAdapter getBrandListAdapter(Context context, List<BrandListBean.ComlistBean> hotList) {
        mCommonAdapter = new CommonAdapter<BrandListBean.ComlistBean>(context, R.layout.search_result_item_layout, hotList) {
            @Override
            protected void convert(ViewHolder holder, BrandListBean.ComlistBean relistBean, int position) {

                holder.setNetworkImage(R.id.iv, relistBean.getSmallimgurl());
                holder.setText(R.id.titleTv, relistBean.getName());
                holder.setText(R.id.bvPriceTv, relistBean.getBvprice() + "BV");
                holder.setText(R.id.priceTv, "￥" + relistBean.getPrice());
                holder.setText(R.id.memberPriceTv, "￥" + relistBean.getHyprice());
                holder.setText(R.id.sanPriceTv, "￥" + relistBean.getSanfprice());
                ((TextView) holder.getView(R.id.sanPriceTv)).getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
            }
        };
        return mCommonAdapter;
    }


    public static CommonAdapter getImageProductListAdapter(Context context, List<ImageGoodsListBean.ComlistBean> hotList) {
        mCommonAdapter = new CommonAdapter<ImageGoodsListBean.ComlistBean>(context, R.layout.search_result_item_layout, hotList) {
            @Override
            protected void convert(ViewHolder holder, ImageGoodsListBean.ComlistBean relistBean, int position) {

                holder.setNetworkImage(R.id.iv, relistBean.getSmallimgurl());
                holder.setText(R.id.titleTv, relistBean.getName());
                holder.setText(R.id.bvPriceTv, relistBean.getHybvprice() + "BV");
                holder.setText(R.id.priceTv, "￥" + relistBean.getPrice());
                holder.setText(R.id.memberPriceTv, "￥" + relistBean.getHyprice());
                holder.setText(R.id.sanPriceTv, "￥" + relistBean.getSanfprice());
                ((TextView) holder.getView(R.id.sanPriceTv)).getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);

            }
        };
        return mCommonAdapter;
    }


    public static CommonAdapter getPaySuccessListAdapter(Context context, List<PaySuccessBean.ComlistBean> hotList) {
        mCommonAdapter = new CommonAdapter<PaySuccessBean.ComlistBean>(context, R.layout.search_result_item_layout, hotList) {
            @Override
            protected void convert(ViewHolder holder, PaySuccessBean.ComlistBean relistBean, int position) {

                holder.setNetworkImage(R.id.iv, relistBean.getSmallimgurl());
                holder.setText(R.id.titleTv, relistBean.getName());
                holder.setText(R.id.bvPriceTv, relistBean.getBvprice() + "BV");
                holder.setText(R.id.priceTv, "￥" + relistBean.getPrice());
                holder.setText(R.id.memberPriceTv, "￥" + relistBean.getHyprice());
                holder.setText(R.id.sanPriceTv, "￥" + relistBean.getSanfprice());
                ((TextView) holder.getView(R.id.sanPriceTv)).getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
            }
        };
        return mCommonAdapter;
    }


    public static CommonAdapter getMessageListAdapter(Context context, List<MessageBean.MsglistBean> data) {

        mCommonAdapter = new CommonAdapter<MessageBean.MsglistBean>(context, R.layout.message_center_item_layout, data) {
            @Override
            protected void convert(ViewHolder holder, MessageBean.MsglistBean o, int position) {
                holder.setText(R.id.messageTitleTv, o.getTitlename());
                holder.setText(R.id.messageContentTv, o.getContent());
            }

        };
        return mCommonAdapter;
    }

    public static CommonAdapter getProductDetailLabelListAdapter(Context context, List<String> data) {

        mCommonAdapter = new CommonAdapter<String>(context, R.layout.product_detail_label_item_layout, data) {
            @Override
            protected void convert(ViewHolder holder, String o, int position) {
                holder.setText(R.id.tv, o);
            }

        };
        return mCommonAdapter;
    }

    public static CommonAdapter getProductCommentListAdapter(Context context, List<AllCommentListBean.CommentlistBean> data) {

        mCommonAdapter = new CommonAdapter<AllCommentListBean.CommentlistBean>(context, R.layout.layout_comment_list, data) {
            @Override
            protected void convert(ViewHolder holder, AllCommentListBean.CommentlistBean o, int position) {
                String evimgurl = o.evimgurl;
//                holder.setNetworkCircleImage(R.id.avatarIv, o.smallimgurl);
                holder.setText(R.id.nameTv, o.tel.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"));
                holder.setText(R.id.levelTv, o.levelname);
                holder.setText(R.id.dateTv, o.createtime);
                holder.setText(R.id.commentsTv, o.evaluate_ramrk);
                List<String> imgList = new ArrayList<>();
                if (evimgurl.contains(",")) {
                    for (int i = 0; i < evimgurl.split(",").length; i++) {
                        imgList.add(evimgurl.split(",")[i]);
                    }
                } else {
                    imgList.add(evimgurl);
                }
                holder.setRecyclerViewGrid(R.id.commentsRecyclerView, getProductCommentImageListAdapter(context, imgList), 3);
            }

        };
        return mCommonAdapter;
    }

    public static CommonAdapter getProductCommentImageListAdapter(Context context, List<String> data) {

        mCommonAdapter = new CommonAdapter<String>(context, R.layout.image_layout, data) {
            @Override
            protected void convert(ViewHolder holder, String o, int position) {
                holder.setNetworkImage(R.id.iv, o);
            }

        };
        return mCommonAdapter;
    }


}
